package com.ncloud.timetask.business;

import com.ncloud.timetask.dashboard.service.MoveHistoryServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by shiqiang on 2017/7/6.
 */
@Component
public class MoveHistoryBusi {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
    @Autowired
    private MoveHistoryServer moveHistoryServer;
    @Transactional
    public void moveHistory(String state,Long orderId){
        Integer sum = moveHistoryServer.orderIsMove(state,orderId);
        if(sum !=null && sum<=0){
            // 更新工单状态
            moveHistoryServer.updateWorkStateHis(orderId);
            //入历史表
            moveHistoryServer.moveOrderHis(orderId);
            moveHistoryServer.moveWorkHis(orderId);
            logger.debug("进入历史表order_id="+orderId);
        }
    }
}
